package com.itheima.objectoutputstream;

import com.itheima.domain.Student;
import com.itheima.domain.Student2;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class Test5 {
    public static void main(String[] args) throws IOException {
//
//	请定义main()方法，创建一个Student对象：
//		Student stu = new Student(“迪丽热巴”,”女”,18);
//		//定义一个序列化对象：ObjectOutputStream，将stu序列化到文件“test5_1.txt”中
        Student2 stu = new Student2("迪丽热巴","女",18);
        ObjectOutputStream op = new ObjectOutputStream(new FileOutputStream("test5_1.txt"));
        op.writeObject(stu);
        op.close();
    }
}
